import request from '@/utils/request';

/**
 * 保存权限信息
 * @param {*} permission
 */
export const save = permission => {
  return request({
    url: '/admin/permission/save',
    data: permission,
    method: 'post'
  });
};

/**
 * 更新权限信息
 * @param {*} permission
 */
export const update = permission => {
  return request({
    url: '/admin/permission/update',
    data: permission,
    method: 'post'
  });
};

/**
 * 获取权限详情
 * @param {*} id
 */
export const get = id => {
  return request({
    url: '/admin/permission/get',
    data: {
      id: id
    },
    method: 'post'
  });
};

/**
 * 删除权限信息
 * @param {*} id
 */
export const remove = id => {
  return request({
    url: '/admin/permission/delete',
    data: {
      id: id
    },
    method: 'post'
  });
};

/**
 * 分页查询权限信息
 * @param {*} params
 */
export const page = params => {
  return request({
    url: '/admin/permission/page',
    data: params,
    method: 'post'
  });
};

/**
 *  权限树
 * @param {*} params
 */
export const trees = params => {
  return request({
    url: '/admin/permission/trees',
    data: params,
    method: 'post'
  });
};
